import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';

export class CreateDishDto {
  @ApiProperty({ description: '菜品名称' })
  @IsNotEmpty({ message: '菜品名称不能为空' })
  @IsString({ message: '菜品名称必须是字符串类型' })
  readonly name: string;

  @ApiProperty({ description: '菜品描述' })
  @IsOptional()
  @IsString({ message: '菜品描述必须是字符串类型' })
  readonly description?: string;

  @ApiProperty({ description: '菜品价格' })
  @IsNotEmpty({ message: '菜品价格不能为空' })
  @IsNumber({}, { message: '菜品价格必须是数字类型' })
  readonly price: number;

  @ApiProperty({ description: '菜品图片' })
  @IsOptional()
  @IsString({ message: '菜品图片必须是字符串类型' })
  readonly image?: string;

  @ApiProperty({ description: '菜品类别 ID' })
  @IsNotEmpty({ message: '菜品类别 ID 不能为空' })
  @IsNumber({}, { message: '菜品类别 ID 必须是数字类型' })
  readonly categoryId: number;

  @ApiProperty({ description: '餐厅 ID' })
  @IsNotEmpty({ message: '餐厅 ID 不能为空' })
  @IsNumber({}, { message: '餐厅 ID 必须是数字类型' })
  readonly restaurantId: number;

  @ApiProperty({ description: '菜品库存' })
  @IsOptional()
  @IsNumber({}, { message: '菜品库存必须是数字类型' })
  readonly stock?: number;

  @ApiProperty({ description: '是否售罄' })
  @IsOptional()
  @IsNumber({}, { message: '是否售罄必须是布尔类型' })
  readonly soldOut?: boolean;
}
